// 用户相关类型
export interface User {
  id: string;
  email: string;
  nickname: string;
  avatarUrl?: string;
  createdAt: Date;
  updatedAt: Date;
}

export interface UserProfile {
  id: string;
  nickname: string;
  avatarUrl?: string;
}

// 配对相关类型
export interface Couple {
  id: string;
  name: string;
  createdAt: Date;
  themeConfig?: ThemeConfig;
}

export interface CoupleInvite {
  id: string;
  coupleId: string;
  inviteCode: string;
  expiresAt: Date;
  createdAt: Date;
}

// 消息相关类型
export enum MessageType {
  TEXT = 'text',
  IMAGE = 'image',
  EMOJI = 'emoji',
  SYSTEM = 'system'
}

export enum MessageStatus {
  SENT = 'sent',
  DELIVERED = 'delivered',
  READ = 'read'
}

export interface Message {
  id: string;
  coupleId: string;
  senderId: string;
  type: MessageType;
  content: string;
  imageUrl?: string;
  status: MessageStatus;
  createdAt: Date;
  updatedAt: Date;
}

// 计划和任务相关类型
export enum PlanStatus {
  ACTIVE = 'active',
  COMPLETED = 'completed',
  ARCHIVED = 'archived'
}

export interface Plan {
  id: string;
  coupleId: string;
  title: string;
  description?: string;
  dueDate?: Date;
  status: PlanStatus;
  createdAt: Date;
  updatedAt: Date;
  tasks: Task[];
}

export interface Task {
  id: string;
  planId: string;
  title: string;
  description?: string;
  done: boolean;
  assigneeId?: string;
  dueDate?: Date;
  order: number;
  createdAt: Date;
  updatedAt: Date;
}

// 相册相关类型
export interface Album {
  id: string;
  coupleId: string;
  title: string;
  description?: string;
  createdAt: Date;
  photos: Photo[];
}

export interface Photo {
  id: string;
  albumId: string;
  url: string;
  thumbUrl: string;
  caption?: string;
  tags: string[];
  takenAt?: Date;
  createdAt: Date;
}

// 游戏相关类型
export enum GameType {
  GOMOKU = 'gomoku', // 五子棋
  CHECKERS = 'checkers', // 跳棋
  PUZZLE = 'puzzle' // 拼图
}

export enum GameStatus {
  WAITING = 'waiting',
  PLAYING = 'playing',
  FINISHED = 'finished'
}

export interface Game {
  id: string;
  coupleId: string;
  type: GameType;
  status: GameStatus;
  currentTurn?: string; // 当前回合的用户ID
  winner?: string; // 获胜者ID
  state: any; // 游戏状态JSON
  createdAt: Date;
  updatedAt: Date;
}

// 通知相关类型
export enum NotificationType {
  MESSAGE = 'message',
  TASK_ASSIGNED = 'task_assigned',
  TASK_COMPLETED = 'task_completed',
  PLAN_UPDATED = 'plan_updated',
  PHOTO_ADDED = 'photo_added',
  GAME_INVITE = 'game_invite',
  ANNIVERSARY = 'anniversary'
}

export interface Notification {
  id: string;
  coupleId: string;
  userId: string;
  type: NotificationType;
  title: string;
  message: string;
  payload?: any;
  read: boolean;
  createdAt: Date;
}

// 主题配置类型
export interface ThemeConfig {
  primaryColor: string;
  backgroundColor: string;
  fontFamily: string;
  wallpaperUrl?: string;
}

// WebSocket 事件类型
export interface SocketEvents {
  // 聊天事件
  'chat:message:new': Message;
  'chat:message:read': { messageId: string; userId: string };
  'chat:typing': { userId: string; isTyping: boolean };
  
  // 计划事件
  'plans:updated': Plan;
  'tasks:updated': Task;
  
  // 相册事件
  'album:photo:added': Photo;
  
  // 游戏事件
  'game:state': Game;
  'game:move': { gameId: string; move: any };
  'game:reset': { gameId: string };
  
  // 用户状态事件
  'user:online': { userId: string };
  'user:offline': { userId: string };
}

// API 响应类型
export interface ApiResponse<T = any> {
  success: boolean;
  data?: T;
  error?: string;
  message?: string;
}

export interface PaginatedResponse<T> {
  items: T[];
  total: number;
  page: number;
  limit: number;
  hasNext: boolean;
  hasPrev: boolean;
}

// 认证相关类型
export interface LoginRequest {
  email: string;
  password: string;
}

export interface RegisterRequest {
  email: string;
  password: string;
  nickname: string;
}

export interface AuthResponse {
  user: User;
  accessToken: string;
  refreshToken: string;
}

// 文件上传类型
export interface UploadResponse {
  url: string;
  thumbUrl?: string;
  filename: string;
  size: number;
  mimeType: string;
}